/**
 ********************************************************************
 * @author roocket
 * @file    video.h
 * @version V0.0.0
 * @date    2024/3/22
 * @brief   This file is to indicate video functions. 
 * @attention Code file rules:
 * rule: file encoding use UTF8;
 * rule: max line length 120 characters;
 * rule: line separator \r\n;
 * rule: use clion auto code format tool.
 */

#ifndef _VIDEO_H_
#define _VIDEO_H_
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/time.h>

#define QUEUE_MAX_NUM 8 /* for queue number */

struct video_compatible_info {
    unsigned int width;
    unsigned int height;
    unsigned int pixel_format;
    unsigned char *mmap_addr[QUEUE_MAX_NUM];
    unsigned int addr_length[QUEUE_MAX_NUM];
    struct v4l2_buffer vb;
};

void video_get_data(void);

int video_init(const char *video, struct video_compatible_info *vfo);
void video_be_capturing(struct video_compatible_info *vfo);
int video_get_bulk_images(const char *dir, int fd, struct video_compatible_info *ci, unsigned short bulks);
int video_del(int fd, struct video_compatible_info *vfo);
void video_get_data(void);

#endif /* _VIDEO_H_ */

